Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: mention id field in 1-abstract-dto.rst #3803

Merged
merged 2 commits into from
Jan 5, 2025
Merged

docs: mention id field in 1-abstract-dto.rst #3803

merged 2 commits into from
Jan 5, 2025

Conversation

sobolevn
Copy link
Member

It caught my attention that it was never explained: why do we have an extra id field in the response. Since this part is dedicated to explaining how request / response fields are marked, I think that it is important to mention that id is special:
Снимок экрана 2024-10-15 в 18 50 23

I had to grep what .my_lib is and how class _Base(CommonTableAttributes, UUIDPrimaryKey, DeclarativeBase): is constructed. Only finding UUIDPrimaryKey and its id: Mapped[UUID] = mapped_column(default=uuid4, primary_key=True) has anwsered my question :)

@sobolevn sobolevn requested review from a team as code owners October 15, 2024 15:52
@github-actions github-actions bot added area/docs This PR involves changes to the documentation size: small type/docs pr/external Triage Required 🏥 This requires triage labels Oct 15, 2024
Copy link

@provinzkraut
Copy link
Member

I'm not really sure "special" is the right wording here, since it's simply an inherited attribute. It only happens to be the only one that's inherited from the base class, but there's nothing special about the id attribute itself

@sobolevn
Copy link
Member Author

@provinzkraut can we say that "id is readonly because it is a primary key"?

@provinzkraut
Copy link
Member

@provinzkraut can we say that "id is readonly because it is a primary key"?

I think it should say something like "we mark id read only since it represents a primary key", to emphasize that this isn't done automagically, and could apply to other arbitrary fields as well

Copy link

codecov bot commented Jan 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.36%. Comparing base (93aa6bf) to head (4edd216).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3803   +/-   ##
=======================================
  Coverage   98.36%   98.36%           
=======================================
  Files         346      347    +1     
  Lines       15690    15722   +32     
  Branches     1737     1737           
=======================================
+ Hits        15433    15465   +32     
  Misses        122      122           
  Partials      135      135           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cofin
Copy link
Member

cofin commented Jan 5, 2025

I'm going to go ahead and merge with the provided updates. We can open a followup PR to dial in the verbiage if needed.

Thanks @sobolevn

@cofin cofin enabled auto-merge (squash) January 5, 2025 01:21
@cofin cofin merged commit 75d3430 into main Jan 5, 2025
24 checks passed
@cofin cofin deleted the dto-mention-id branch January 5, 2025 01:21
Copy link

sonarqubecloud bot commented Jan 5, 2025

Copy link

github-actions bot commented Jan 5, 2025

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3803

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs This PR involves changes to the documentation pr/external pr/internal size: small Triage Required 🏥 This requires triage type/docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants